/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2013
 */

package com.smg.community.dao;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import com.smg.community.model.*;
import com.smg.community.dao.*;
import com.smg.community.service.*;
import com.smg.community.vo.query.*;

/**
 * @author badqiu email:badqiu(a)gmail.com
 * @version 1.0
 * @since 1.0
 */


import org.springframework.stereotype.Repository;


@Repository
public class SmgGroupMemberDao extends BaseIbatis3Dao<SmgGroupMember,java.lang.Integer>{
	
	@Override
	public String getIbatisMapperNamesapce() {
		return "SmgGroupMember";
	}
	
	public void saveOrUpdate(SmgGroupMember entity) {
		if(entity.getMid() == null) 
			save(entity);
		else 
			update(entity);
	}
	
	public Page findPage(SmgGroupMemberQuery query) {
		return pageQuery("SmgGroupMember.findPage",query);
	}

	public SmgGroupMember getByGroupIdAndMemberId(int groupId, int memberId) {
		Map  parameter = new HashMap<String,String>();
		parameter.put("groupId",groupId);
		parameter.put("memberId", memberId);
		return (SmgGroupMember)this.getSqlSessionTemplate().selectOne("SmgGroupMember.getByGroupIdAndMemberId", parameter);
	}

	public void delete(Integer memberId, int groupId) {
		Map  parameter = new HashMap<String,String>();
		parameter.put("groupId",groupId);
		parameter.put("memberId", memberId);
		this.getSqlSessionTemplate().update("SmgGroupMember.delete", parameter);
		
	}
	

}
